#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
class Solution {
public:
    int minMoves(vector<int>& nums) {
		sort(nums.begin(), nums.end());
		int sum = 0;
		for_each(nums.begin() + 1, nums.end(), [&](int n) {sum += n-nums[0]; });
		return sum;
    }
};
int main()
{
	vector<int> iv{ 1,2,3 };
	cout << Solution().minMoves(iv);
}